package edu.sctu.zhengsenwen.month201506.day20150612;

/**
 * Created by user15 on 2015/6/14.
 */
public class MyThread extends Thread {

    int number = 0;
    int count = 1;

    public MyThread(int num) {

        number = num;

        System.out.println("创建线程"+number);
    }

    public void run() {

        while (true) {

            System.out.println("线程：  " + number + "： 计数" + count);

            if (++count == 6) {
                return;
            }
        }
    }


    public static void main(String[] args) {

        for (int i = 0; i < 5; i++) {

            new MyThread(i + 1).start();
        }
    }
}
